package com.atguigu.gmall;

import org.csource.common.MyException;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient1;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.util.ClassUtils;

import java.io.IOException;

public class TestFileUpload {

    //上传文件
    public static void main(String[] args) throws IOException, MyException {

        String path = ClassUtils.getDefaultClassLoader().getResource("tracker.conf").getPath();

        ClientGlobal.init(path);

        TrackerClient trackerClient = new TrackerClient();

        TrackerServer connection = trackerClient.getConnection();

        StorageClient1 storageClient1 = new StorageClient1(connection, null);

        String image1 = storageClient1.upload_file1(
                "C:\\Users\\cjMoke\\Desktop\\头像.jpg", "jpg", null);

        System.out.println(image1);


    }

}
